package com.inspur.controller;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.inspur.entity.TestEntity;
import com.inspur.service.TestService;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;

@Controller
public class TestController {
    @Autowired
    private TestService testService;
    private List<TestEntity> userList;
//    @RequestMapping("toVerticalIndex")
//    public String toVerticalIndex(Model model,Map<String, Object> map, HttpServletRequest request){
//        return "jsp/vertical_index";
//    }
//    @RequestMapping("toLoginIndex")
//    public String toLoginIndex(Model model,Map<String, Object> map, HttpServletRequest request){
//        return "jsp/main_index";
//    }
    @RequestMapping(value="toTestList", method = RequestMethod.GET)
    @ApiOperation(value = "获取全部的用户", httpMethod = "GET", response = List.class, notes = "获取全部的用户")
    public String toTestList(Model model,Map<String, Object> map, HttpServletRequest request){
        userList=testService.getAllFriend();
        map.put("userList", userList);
        return "jsp/test_list1";
    }
//    @RequestMapping("getTestListData")
//    public List<TestEntity> getTestListData(){
//        return testService.getAllFriend();
//    }
    @RequestMapping(value="toViewInfo", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "根据用户id获取用户对象", httpMethod = "GET", response = List.class, notes = "根据用户id获取用户对象")
    public String toViewInfo(Model model,Map<String, Object> map, HttpServletRequest request,
            @ApiParam(required = true, name = "id", value = "用户id") @PathVariable String id){
        return "jsp/view_info";
    }
}
